#include <stdio.h>
int main( )
{
    int i,inner,outer,temp;
    int nums[10]={12,56,489,78,123,6,89,8899,5,664};
    printf("%-20s","Before sorting: ");
    for(i=0; i<10; i++)                        
    {
        printf("%d ",nums[i]);
    }
    for(outer=0; outer<9; outer++)              //外层循环
        for(inner=outer+1; inner<10; inner++)   //内层循环
        {
            if(nums[inner]>nums[outer])         //比较大小
            {
                temp=nums[outer];
                nums[outer]=nums[inner];
                nums[inner]=temp;
            }                                   //互换
        }
    printf("%-20s","\nAfter sorting:");
    for(i=0; i<10; i++)                         //输出排序后的数列
        printf("%d ",nums[i]);
    printf("\n");
    system("pause");
    return 0;
}

